﻿using AutoMapper;
using MediatR;
using S.Breeding.Domain;
using S.Breeding.Infrastructure;
using S.Breeding.Read.Api.Application.Command.BodyMeasureCommand;

namespace S.Breeding.Read.Api.Application.CommandHandlers.BodyMeasureCommandHandlers
{
    public class BodyMeasureEditCommandHandlers : IRequestHandler<BodyMeasureEditCommand, BodyMeasure>
    {
        private readonly IRepository<BodyMeasure> repository;
        private readonly IMapper mapper;
        public BodyMeasureEditCommandHandlers(IRepository<BodyMeasure> repository, IMapper mapper)
        {
            this.repository = repository;
            this.mapper = mapper;
        }

        public async Task<BodyMeasure> Handle(BodyMeasureEditCommand request, CancellationToken cancellationToken)
        {
            return await repository.GetAsync(request.BMID);
        }
    }
}
